package com.twu.biblioteca;


import java.io.*;
import java.util.*;

public class Users {
    public Map<String, User> userTable = new HashMap<String, User>();

    public Users() {
        this.addUser();
    }

    public void addUser() {
        File file = new File("bin/user_list.txt");
        try {
            BufferedReader buffer = new BufferedReader(new FileReader(file));
            String line;
            String[] userInfo;
            while ((line = buffer.readLine()) != null) {
                userInfo = line.split(",");
                User user = new User(userInfo[2], userInfo[3], userInfo[4],userInfo[0],userInfo[1]);
                userTable.put(userInfo[0],user);
            }
            buffer.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}
